package internal

import (
	"im/internal/api"
	"im/internal/middleware"

	"github.com/gin-gonic/gin"
)

func InitRouter(router *gin.Engine) {
	//middleware.ResponseHandler()用户捕获 common/Response
	router.Use(middleware.ResponseHandler(), middleware.CorsMiddleware())
	//用户接口
	{
		user := router.Group("/user")
		user.POST("/login", api.Login)
		user.GET("/search", middleware.FastAuthMiddleware, api.Search)
	}
	//好友接口
	{
		friend := router.Group("")
		friend.Use(middleware.FastAuthMiddleware)
		friend.GET("apply_to_add_friend", api.ApplyToAddFriend)
		friend.POST("respond_friend_apply", api.RespondFriendApply)
		friend.DELETE("delete_friend", api.DeleteFriend)
		friend.POST("add_block", api.AddBlock)
		friend.DELETE("remove_block", api.RemoveBlock)
		friend.GET("get_friend_info", api.GetFriendInfo)
		friend.GET("get_designated_friends", api.GetDesignatedFriends)
		friend.POST("set_friend_remark", api.SetFriendRemark)
		friend.GET("is_friend", api.IsFriend)
		friend.GET("get_friend_ids", api.GetFriendIDs)
		friend.GET("get_pagination_friends_apply_to", api.GetPaginationFriendsApplyTo)
		friend.GET("get_pagination_friends_apply_from", api.GetPaginationFriendsApplyFrom)
		friend.GET("is_block", api.IsBlock)
	}

	//router.GET("/login", index.Login)
	//router.POST("/login", index.Login)
	//
	//router.GET("/auth-login", index.AuthLogin)
	//router.POST("/auth-login", index.AuthLogin)
	////api接口
	//{
	//	user := router.Group("/user")
	//
	//	user.POST("/login", api.Login)
	//}
	////好友接口
	//{
	//	friend := router.Group("/friend")
	//	//需要用户登录
	//	friend.Use(middleware.FastAuthMiddleware)
	//	//查找好友
	//	friend.GET("/search", api.Search)
	//	//好友信息
	//	friend.GET("/list", api.List)
	//	friend.GET("/user_id", api.UserId)
	//	friend.GET("/user_ids", api.UserIds)
	//	//好友申请
	//	friend.POST("/request", api.SendFriendRequest)
	//	friend.POST("/accept", api.AcceptFriendRequest)
	//	friend.POST("/reject", api.RejectFriendRequest)
	//	//黑名单管理
	//	friend.GET("/block", api.GetBlock)
	//	friend.POST("/block", api.PostBlock)
	//	friend.DELETE("/block", api.DeleteBlock)
	//	//分组管理
	//	//好友备注修改
	//	//消息免打扰
	//
	//	//会话列表页
	//	//显示未读消息数 , 最后消息预览 , 支持置顶
	//	//单聊窗口 文字/图片/位置分享 , 消息撤回 (2分钟内)
	//}

	//router.GET("/broadcast", api.Broadcast)
	//router.GET("/ping", api.Ping)
	//
	//router.GET("/", index.View)
}
